﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using FA.FlightAttendant.View.Commands;

namespace FA.FlightAttendant.ViewModel.Windows
{
    /// <summary>
    /// Viewmodel for Main Window.
    /// </summary>
    public class MainWindowVM : ViewModel
    {
        public bool IsEnabled
        {
            get { return _enabled; }
            set
            {
                if (_enabled != value)
                {
                    _enabled = value;
                    NotifyPropertyChanged("Enabled");
                }
            }
        }
        private bool _enabled;

        public string StatusText
        {
            get { return _statusText; }
            set
            {
                if (_statusText != value)
                {
                    _statusText = value;
                    NotifyPropertyChanged("StatusText");
                }
            }
        }
        private string _statusText;

        public MainWindowVM()
        {
            Program.StatusChanged += new EventHandler<TextEventArgs>(Program_StatusChanged);
            Program.Initialised += new ParameterlessEventHandler(Program_Initialised);
        }

        private void Program_StatusChanged(object sender, TextEventArgs e)
        {
            StatusText = e.Text;
        }

        private void Program_Initialised()
        {
            IsEnabled = true;
        }
    }
}
